package com.tmt.im.common.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.tmt.im.common.annotation._AllowUpdate;
import com.tmt.im.common.enums.AddFriendMode;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;
import org.apache.ignite.cache.query.annotations.QuerySqlField;

import java.io.Serial;
import java.sql.Timestamp;

/**
 * @Description TODO
 * @Author wuyi
 * @Date 2024/9/2 16:52
 * @Version 1.0
 **/
@Getter
@Setter
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class IMFriendGroupMappingPoJo implements IGetKey<Long> {

    @Serial
    private static final long serialVersionUID = 6584355289964276180L;

    public static final String CACHE_NAME = "im_friend_group_mapping";

    @QuerySqlField(name = "id", index = true)
    private Long id;

    /**
     * 申请人希望添加的好友ID。
     */
    @QuerySqlField(name = "friend_id")
    private Long friendId;

    /**
     * 好友分组ID。
     */
    @QuerySqlField(name = "group_id")
    private Long groupId;

    /**
     * 本条分组映射记录的创建者。
     */
    @QuerySqlField(name = "creator_id")
    private Long creatorId;

    @QuerySqlField(name = "create_time")
    private Timestamp createTime;

    @QuerySqlField(name = "version")
    @_AllowUpdate
    private Long version;

    @JsonIgnore
    private boolean insert;

    @Override
    public Long getKey() {
        return id;
    }
}
